class jk {
    constructor(option = {}) {

        if (!jk.__jk__) {
            jk.__jk__ = this
        } else {
            return jk.__jk__
        }
        this.create = option?.create ?? (() => { console.log('create') })
        this.update = option?.update ?? (() => { console.log('uodate') })
        this.dispose = option?.dispose ?? (() => { console.log('dispose') })
        this.el = option?.el ?? 'body'
        this.iframe = null

        this.init()
    }
    init() {
        this.create()
        this.iframe = document.querySelector(this.el)
    }

    listen() {
        this.iframe.addEventListener('click', this.click)
        this.update()
    }

    close() {
        this.iframe.addEventListener('click', this.click)
        this.dispose()
    }
    click(e) {
        console.log(e, '点击事件=====')
    }
}

let a = new jk({
    create: () => {
        console.log("我是创建的=======1")
    }
})

let b = new jk({
    update: () => {
        console.log(this, 'defefefe')
    }
})